﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace RO___Simulasi_Boarding
{
    class Passanger
    {
        Point coordinate;
        Point destination;

        int baggage;
        int firstBaggage;
        int doorin;

        public int DoorIn
        {
            get {return doorin;}
            set {doorin = value;} 
        }
        public int FirstBaggage
        {
            get { return firstBaggage; }
            set { firstBaggage = value; }
        }

        bool statusGeser;
        public bool StatusGeser
        {
            get { return statusGeser; }
            set { statusGeser = value; }
        }

        public int Baggage
        {
            get { return baggage; }
            set { baggage = value; }
        }

        int group;
        string id;
        public string Id
        {
            get { return id; }
            set { id = value; }
        }

        public Passanger() { }
        public Passanger(Point coordinate, Point destination, int group, string id, int baggage, int doorin)
        {
            this.coordinate = coordinate;
            this.destination = destination;
            this.group = group;
            this.baggage = baggage;
            this.id = id;
            this.statusGeser = false;
            this.doorin = doorin;
            firstBaggage = baggage;
        }
        public void gambar(Graphics g, int left, int top)
        {
            if (group == 6)
                g.FillEllipse(Brushes.Gainsboro, left + coordinate.X * 35 - 3, top + coordinate.Y * 35 + 4, 25, 25);
            else if (group == 5)
                g.FillEllipse(Brushes.LightSkyBlue, left + coordinate.X * 35 - 3, top + coordinate.Y * 35 + 4, 25, 25);
            if (group == 4)
                g.FillEllipse(Brushes.RosyBrown, left + coordinate.X * 35 - 3, top + coordinate.Y * 35 + 4, 25, 25);
            else if(group == 3)
                g.FillEllipse(Brushes.SandyBrown, left + coordinate.X * 35 - 3, top + coordinate.Y * 35 + 4, 25, 25);
            else if (group == 2)
                g.FillEllipse(Brushes.Yellow, left + coordinate.X * 35 - 3, top + coordinate.Y * 35 + 4, 25, 25);
            else if (group == 1)
                g.FillEllipse(Brushes.LightGreen, left + coordinate.X * 35 - 3, top + coordinate.Y * 35 + 4, 25, 25);
            g.DrawEllipse(Pens.Black, left + coordinate.X * 35 - 3, top + coordinate.Y * 35 + 4, 25, 25);
            g.DrawString(group.ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.Black, left + coordinate.X * 35 - 3, top + coordinate.Y * 35 + 7);
            g.DrawString(id, new Font("Arial", 6), Brushes.Black, left + coordinate.X * 35 +5, top + coordinate.Y * 35 + 8);
            g.DrawString(baggage.ToString(), new Font("Arial", 6), Brushes.Black, left + coordinate.X * 35 + 10, top + coordinate.Y * 35 + 16);
        }
        public void setCoordinate(Point p)
        {
            coordinate = p;
        }
        public Point getCoordinate()
        {
            return coordinate;
        }
        public void setDestination(Point p)
        {
            destination = p;
        }
        public Point getDestination()
        {
            return destination;
        }
        public void entering(Point pStart)
        {
            coordinate = pStart;
        }
        public int getGroup()
        {
            return group;
        }
        public void baggaging()
        {
            if (baggage > 0) baggage--;
        }
        public void resetTo(Point position)
        {
            this.coordinate = position;
            this.baggage = firstBaggage;
            this.statusGeser = false;
        }
    }
}
